/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.BasicActivities;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.BasicBehaviors.Behavior;
import edu.pku.sei.modeler.model.uml.BasicBehaviors.Behavior;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;


/**
 * @generated
 *
 */
public class ObjectFlow extends ActivityEdge implements IObjectFlow {
	// attributes
	
	protected boolean isMulticast;
	
	protected boolean isMultireceive;
	
	
	
	
	// references
	
	protected MetaTypedList transformation;
	
	protected MetaTypedList selection;
	
	
	
	// getters & setters for attributes
	
	@MethodProperty(
			id = "OBJECTFLOW_ISMULTICAST",
			catalog = "Model",
			name = ModelPackage.OBJECTFLOW_ISMULTICAST,
			setter = "setisMulticast"
			)
	
	public boolean getIsMulticast() {
		return isMulticast;
	}
	public void setIsMulticast(boolean newIsMulticast) {
		boolean oldisMulticast = isMulticast;
		isMulticast = newIsMulticast;
		firePropertyChange(ModelPackage.OBJECTFLOW_ISMULTICAST, oldisMulticast, newIsMulticast);
	}
	
	@MethodProperty(
			id = "OBJECTFLOW_ISMULTIRECEIVE",
			catalog = "Model",
			name = ModelPackage.OBJECTFLOW_ISMULTIRECEIVE,
			setter = "setisMultireceive"
			)
	
	public boolean getIsMultireceive() {
		return isMultireceive;
	}
	public void setIsMultireceive(boolean newIsMultireceive) {
		boolean oldisMultireceive = isMultireceive;
		isMultireceive = newIsMultireceive;
		firePropertyChange(ModelPackage.OBJECTFLOW_ISMULTIRECEIVE, oldisMultireceive, newIsMultireceive);
	}
	
	// getters for references
	
	public MetaTypedList getTransformation() {
		if(transformation == null) {
			transformation = new MetaTypedList(Behavior.class, this, ModelPackage.OBJECTFLOW_TRANSFORMATION);
		}
		return transformation;
	}
	
	public MetaTypedList getSelection() {
		if(selection == null) {
			selection = new MetaTypedList(Behavior.class, this, ModelPackage.OBJECTFLOW_SELECTION);
		}
		return selection;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.OBJECTFLOW_ISMULTICAST, isMulticast);
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.OBJECTFLOW_ISMULTIRECEIVE, isMultireceive);
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.OBJECTFLOW_TRANSFORMATION, transformation);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.OBJECTFLOW_SELECTION, selection);		
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		isMulticast = XMLUtility.xmlInstance.deSerializeBoolean(root, ModelPackage.OBJECTFLOW_ISMULTICAST);
		
		isMultireceive = XMLUtility.xmlInstance.deSerializeBoolean(root, ModelPackage.OBJECTFLOW_ISMULTIRECEIVE);
		
		// references
		
		this.getTransformation().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.OBJECTFLOW_TRANSFORMATION, this));
		
		this.getSelection().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.OBJECTFLOW_SELECTION, this));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.OBJECTFLOW_TRANSFORMATION.equals(featureID)) {
			getTransformation().add(value);
		}
		
		else if(ModelPackage.OBJECTFLOW_SELECTION.equals(featureID)) {
			getSelection().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 